home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Tools & Apps / Misc. Utilities / Installer 3.4 / Examples - Installer 3.4 / Action Atom Samples / InstallFileOnBootVolAA / InstallFileOnBootVol.r < prev   
Encoding:
Text File  |  1992-09-21  |  7.4 KB  |  194 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: Action Atom sample to install a file in the
  6.  *                            System Folder of the boot volume.
  7.  *
  8.  *    File:        InstallFileOnBootVol.r -    Rez Source
  9.  *
  10.  *    by:            Rich Kubota
  11.  *
  12.  *    Copyright © 1991 Apple Computer, Inc.
  13.  *    All rights reserved.
  14.  *
  15.  *------------------------------------------------------------------------------
  16.  *
  17.  * Install application "TheProgram" into the Start-up folder in the boot system
  18.  * folder regardless of the volume selected by the user.  There are a number of 
  19.  * caveats associated with using this sample action atom.  See the code resource
  20.  * for the specific caveats.
  21.  *----------------------------------------------------------------------------*/
  22.  
  23. #include "Types.r"
  24. #include "InstallerTypes.r"
  25.  
  26. /* 'inaa' code resource definition */
  27. #define        aaCodeID                128
  28.  
  29. /* You can build and complete the script with the following lines:
  30. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  31. # or set up folders with the same names and contents as the floppies
  32. # put these folders in the same folder as the script or at the root directory of same disk
  33.  
  34.     rez -o "InstallFileOnBootVol" -t 'bbkr' -c 'bbkr' "InstallFileOnBootVol.r"
  35.     setfile -a i "InstallFileOnBootVol"        #mark Inited
  36.     scriptcheck -p "InstallFileOnBootVol"
  37. */
  38.  
  39. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  40. #define kScriptCheckSetsDate    0x01
  41. #define kMinMemMB                01    /* memory needed to install (UPDATE Error Message if changed!)*/
  42.  
  43. /* Definitions for the rules */
  44. #define rlCheckMemSize            1000
  45. #define rlOutputMemSizeError    1001
  46.  
  47. /* Defines for the file spec atoms (specifications for source and destination files) */
  48. #define fsSourceProgram            2000
  49. #define fsTargetProgram            2001
  50.  
  51. /* This is the name of the source disk */
  52. #define ProgramDisk "Program Disk:"
  53.  
  54. /* where we want to install our file on the boot volume - use folder mgr designation. */
  55. #define TargetPath    "Special-strt:"
  56.  
  57. /* Definition for the package. */
  58. #define pkTheProgram            3000
  59.  
  60. /* Definition for the file atom */
  61. #define faProgram                4000
  62.  
  63. /* Definition for the package comment resource */
  64. #define cmtTheProgram            5000
  65.  
  66. /* Definitions for the action atom resources */
  67. #define aaInstallFile            6000
  68.  
  69. /* September 1, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  70. /* this value to a LongInt seconds value needed by the Installer. */
  71. #define currentReleaseDate        9011992    
  72. #define currentVersion            101     /* Version 1.0.1 goes in the 'icmt' rsrc */
  73.  
  74. #define iconTheProgram            5100
  75.  
  76. /************************** Easy Install Rule resources **********************************/
  77. resource 'infr' (1) {
  78.     format0  {{
  79.         pickFirst,    {rlCheckMemSize, rlOutputMemSizeError},     /* Select only one of these rules */
  80.     }};
  81. };
  82.  
  83. resource 'inrl' (rlCheckMemSize) {
  84.     format0 {{
  85.         /* If the system has at least kMinMemMB megs of memory, then add the package */
  86.         checkMinMemory {kMinMemMB},
  87.         addUserDescription {"The Program\n"},    /* message to appear in Easy Install screen */
  88.         addPackages {{pkTheProgram}}            /* we're installing the program */
  89.     }};
  90. };
  91.  
  92. resource 'inrl' (rlOutputMemSizeError) {
  93.     format0 {{
  94.         /* This error message will be displayed on the Easy Install screen if this rule */
  95.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  96.         
  97.         reportSysError {"To do installation you need:\n\n"},
  98.         reportSysError {"• At least 1 megabyte of memory\n"}    /*if kMinMemMB changes FIX HERE! */
  99.     }};
  100. };
  101.  
  102. /***************************** Package Resources ************************************************/
  103. resource 'inpk' (pkTheProgram) {
  104.     format0 {
  105.         showsOnCustom,                 /* Package appears in the Custom Install display */
  106.         notRemovable,                /* Package can be removed */
  107.         dontForceRestart,            /* no need to reboot after live install */
  108.         cmtTheProgram,                 /* package's 'icmt' resource id */
  109.         0,                            /* Package size (filled in by ScriptCheck) */
  110.         "Teach Text in Boot System Folder", {                
  111.                                     /* package name for package that shows on custom */
  112.             'inaa', aaInstallFile;
  113.         }
  114.     }
  115. };
  116.  
  117. /***************************** Comments ************************************************/
  118. resource 'icmt' (cmtTheProgram) {
  119.     currentReleaseDate,
  120.     currentVersion,
  121.     iconTheProgram,
  122.     "This package installs TeachText into the startup folder in the boot system folder. "
  123. };
  124.  
  125. resource 'ICON' (iconTheProgram) {
  126.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  127.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  128.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  129.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  130.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  131.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  132.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  133.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  134. };
  135.  
  136.  
  137. /********************************************* File Specs ******************************************/
  138. /* Source File Specs */
  139. resource 'infs' (fsSourceProgram) {
  140.     'APPL',                                /* File Type */
  141.     'ttxt',                                /* Creator */
  142.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  143.     noSearchForFile,                    /* Do not search the source disk for the file */
  144.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  145.     ProgramDisk"TeachText"                /* Path to the file */
  146. };
  147.  
  148. /* Target File Specs */
  149. resource 'infs' (fsTargetProgram) {
  150.     'APPL',                                /* File Type */
  151.     'ttxt',                                /* Creator */
  152.     0,                                    /* creation date not needed for target file specs */
  153.     noSearchForFile,                    /* Do not search the target disk for the file */
  154.     TypeCrMustMatch,                    /* not needed for target file specs */
  155.     TargetPath"TeachText"                /* destination Path */
  156. };
  157.  
  158. /******************************************** File Atoms ************************************************/
  159. resource 'infa' (faProgram) {
  160.     format0 {
  161.         deleteWhenRemoving,                /* Delete the file if remove is clicked(option-custom) */
  162.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  163.         copy,                             /* Copy the file to the destination */
  164.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  165.         updateExisting,                 /* replace an existing copy, if mine is newer */
  166.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  167.         rsrcFork, dataFork,                /* Copy both forks of the file */
  168.         fsTargetProgram,                /* TARGET file spec */
  169.         fsSourceProgram,                 /* SOURCE file spec */
  170.         0,                                /* atom size (filled in by ScriptCheck) */
  171.         ""                                /* Atom Description (for a file Installer will use file name) */
  172.     };
  173. };
  174.  
  175. /******************************************** Action Atoms ************************************************/
  176. resource 'inaa'    (aaInstallFile) {
  177.     format1 {
  178.         continueBusyCursors,            /* have the busy cursor continue to display while file being installed */
  179.         actAfter,                        /* act after the rest of the installation has run */
  180.         dontActOnRemove,                /* the atom does not recognise the option to remove the file */
  181.         actOnInstall,                    /* act when the user clicks the Install button */
  182.         'infn',                            /* resource type of code resource */
  183.         aaCodeID,                        /* code resource ID to execute */
  184.         faProgram,                        /* for this example, pass the 'infa' resource ID of the file to
  185.                                          * copy to the System Folder of the boot disk.
  186.                                          */
  187.         "Installing TeachText in the startup folder on the boot drive."
  188.     }
  189. };
  190.  
  191.  
  192. INCLUDE    "InstallFileOnBootVol.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  193.  
  194.